﻿using System;
using System.Windows.Forms;
using WindowsFormsApplication1;

namespace DocClient
{
    public partial class ClientTile : UserControl
    {
        public String User;
        public int Clientnr;
        private DoctorForm _doctorForm;
        public String ChatMess;

        public ClientTile()
        {
            InitializeComponent();
            pictureBox1.Visible = false;
        }

        public ClientTile(string naam, string id,DoctorForm doctorForm)
        {
            _doctorForm = doctorForm;
            InitializeComponent();
            User = naam;
            Clientnr = Convert.ToInt32(id);

            foreach (Control c in this.Controls)
            {
                if (c != largeViewButton)
                    c.Click += new EventHandler(ClientTile_Click);
            }
            pictureBox1.Visible = false;
        }

        private void ClientTile_Load(object sender, EventArgs e)
        {
            //_doctorForm.BinaryFormatter.Serialize(_doctorForm.serverConnection.GetStream(),"realTimeData:"+Clientnr);
        }

        private void largeViewButton_Click(object sender, EventArgs e)
        {
           // new Grafieken().Show();
            //_doctorForm.BinaryFormatter.Serialize(_doctorForm.serverConnection.GetStream(), "dataPacket:" + Clientnr);
            _doctorForm.secureConnection.SendObject("dataPacket:" + Clientnr);
            _doctorForm.selectedclient = Clientnr;
            _doctorForm.SetOutputTextBoxMessage(ChatMess);
        }

        private void ClientTile_Click(object sender, EventArgs e)
        {
            //_doctorForm.BinaryFormatter.Serialize(_doctorForm.serverConnection.GetStream(), "realTimeData:" + Clientnr);
            _doctorForm.secureConnection.SendObject("realTimeData:" + Clientnr);
            _doctorForm.selectedclient = Clientnr;
            pictureBox1.Visible = false;
            _doctorForm.SetOutputTextBoxMessage(ChatMess);
        }

        private void alarmButton_Click(object sender, EventArgs e)
        {

        }
    }
}
